﻿using System;

namespace JuCheap.Store.DataService.Entity
{
    /// <summary>
    /// 基础实体
    /// </summary>
    public interface IBaseEntity
    {
        /// <summary>
        /// Id 主键
        /// </summary>
        string Id { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        DateTime CreateTime { get; set; }
    }

    public static class BaseEntityExtention
    {
        public static void Create(this IBaseEntity entity)
        {
            if(entity == null)
            {
                return;
            }
            entity.Id = Guid.NewGuid().ToString("N");
            entity.CreateTime = DateTime.Now;
        }
    }
}
